#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

extern char *wordName[10000];
extern char *wordValue[10000];

char *findWord(char *word);

char *getWord(void)
{

  char *word = 0;
  int strLen = 0;
  char c;
  char *string;
  
  printf("welcome to getword\n");
    
  while (((c = getchar())!= '+') 
        && (c != '-') && (c != '*') && (c != '/') && (c != '(') && (c != ')'))
  {
    printf("the present char is : %c\n", c);
        
    if (isspace(c))
    {
      if (!strcmp(string, "THING"))
      {
	    strcpy(word, findWord(findWord(getWord())));
		goto RE;
	  }
      else
      {
	    word = findWord(string);
		goto RE;
	  }	  
	}
	string[strLen++] = c;
  }
  RE:
    return word;
}

char *findWord(char *word)
{
  int i;
  char *answer;
  int wordLen = strlen(word);
 
  printf("welcome to findword\n");
  
  if (word)
  {
    for (i = 0; i < wordLen; i++)
    {
      if (!strcmp(wordName[i], word))
	  {
  	  strcpy(answer, wordValue[i]);
      goto RE;	  
  	  }
    }
  }
  
  answer[0] = 0;
  if (word)
  {
    printf("Please check out the word you input\n");
  };
  goto RE;
  
  RE:
    return &answer[0];
}
